export const detailMixins = {
  data() {
    return {
      detailData: [],
      detailRow: {},
      statusMap: {
        1: {
            0: "待出库",
            1: "已出库",
            2: "已取消",
          },
          2: {
            0: "待入库",
            1: "已入库",
            2: "已取消",
          },
      },
      colorMap: {
        0: 'warning',
        1: 'success',
        2: 'danger',
      },
      statusMapNoChildOut: {
          0: "待出库",
          1: "已出库",
          2: "已取消",
      },
      statusMapNoChildIn: {
          0: "待入库",
          1: "已入库",
          2: "已取消",
      },
    }
  },
  methods: {
    getTransferOrderStatus(status) {
      if (status == '0') return '待审核';
      if (status == '1') return '通过';
      if (status == '2') return '驳回';
      return '';
    },
    getTransferStatus(type){
        return this.statusMapNoChildOut[type]
    },
    getTransferStatusIn(type){
        return this.statusMapNoChildIn[type]
    },
    getColor(type){
        return this.colorMap[type]
    },
    getStatusText(type=2,status) {
        // 0:待出库(待入库) 1:已出库(已入库) 2:已取消
       
        return (
          {
            text: this.statusMap[type][
              status
            ] || "未知状态",
            type: this.colorMap[status] || "warning"
          }
        );
      },
  }
}
